package pri.damai.xiaowu.common.core.enums;


import pri.damai.xiaowu.common.core.enums.base.StringEnumerator;

import java.io.Serializable;

/**
 * 错误值枚举
 * @Desc
 * @Author DaMai
 * @Date 2021/3/23 15:26
 * 但行好事，莫问前程。
 */
public enum ResultCommonEnum implements StringEnumerator, Serializable {

    /** 00: 通用错误 */
    SERVER_ERROR("-999999", "服务器端异常。%s"),
    SUCCESS("000000", "请求业务处理成功。"),
    PARAM_ERROR("000001", "参数错误。"),
    ENUM_ERROR("000002", "枚举值不存在。"),
    // 远程调用异常。
    REMOTE_SERVICE_EXCEPTION("000004", "%s"),

    NOT_SUPPORTED_HTTP_METHOD("000007", "不支持的HTTP请求方法。"),
    AUTHORIZED_FAIL("000008", "认证失败。"),
    SERVER_DATA_ERROR("000009", "业务数据错误。"),
    BUSINESS_CHECK_EXCEPTION("000010", "业务校验异常。"),
    ENCRYPT_ERROR("000011", "加密失败。"),
    DECRYPT_ERROR("000012", "解密失败。"),
    UN_KNOW_SYS("000013", "未知系统标识"),
    ;

    private final String code;
    private final String msg;

    ResultCommonEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String code() {
        return this.code;
    }

    @Override
    public String desc() {
        return this.msg;
    }
}
